package com.frontier.exception;

import lombok.Getter;

/**
 * 业务异常类
 *
 * @author YLS-XuXu
 * @date 2020/9/1
 */
public class CustomException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    /**
     * 异常编码
     */
    @Getter
    private final String errorCode;

    /**
     * 构造器
     *
     * @author YLS-XuXu
     * @date 2020/9/17
     */
    public CustomException(ExceptionInterface exceptionInterface) {
        super(exceptionInterface.getExceptionMsg());
        this.errorCode = exceptionInterface.getExceptionCode();
    }

    /**
     * 构造器
     *
     * @author YLS-XuXu
     * @date 2020/9/17
     */
    public CustomException(String errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
    }
}
